#!/bin/sh

if [ -f /etc/rc.d/init.d/mysql ] ; then
	service mysql stop
else
	service mysqld stop
fi

mv -f /var/lib/mysql/kloxo /var/lib/mysql/kloxoold
latest=$(dir /home/kloxo/selfbackup/self/__backup/*.zip|sort -n|tail -1); unzip $latest -d /tmp
sh /script/upcp -y

if [ -f /etc/rc.d/init.d/mysql ] ; then
	service mysql stop
else
	service mysqld stop
fi

mysqld_safe --init-file=/tmp/mebackup.dump

if [ -f /etc/rc.d/init.d/mysql ] ; then
	service mysql start
else
	service mysqld start
fi
